
<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8">
        <title>浏览页面</title>
        <link rel="stylesheet" href="/app/admin/component/pear/css/pear.css" />
        <link rel="stylesheet" href="/app/admin/admin/css/reset.css" />
        <style>
            audio {
                width: 200px;
                height: 40px;
            }
            .layui-layer-imgtit h3,.layui-layer-imgtit a{
                font-size: 16px;
            }
        </style>
    </head>
    <body class="pear-container">
        <!-- 顶部查询表单 -->
        <div class="layui-card">
            <div class="layui-card-body" style="display: flex;flex-direction: row;align-items: center;">
                <div style="width: 15%;font-size: 16px;font-weight: 400;">小说编号：<a href="javascript:view_novel(this);" class="novel_sn"></a></div>
                <div style="width: 30%;font-size: 16px;font-weight: 400;">小说标题：<span class="novel_title"></span></div>
                <div style="width: 15%;font-size: 16px;font-weight: 400;">方案ID：<span class="plan_id"></span></div>
                <div style="width: 20%;font-size: 16px;font-weight: 400;">方案名称：<span class="plan_name"></span></div>
            </div>
        </div>
        <!-- 数据表格 -->
        <div class="layui-card">
            <div class="layui-card-body">
                <table id="data-table-chapter" lay-filter="data-table-chapter"></table>
            </div>
        </div>

        <!-- 表格顶部工具栏 -->
        <script type="text/html" id="table-toolbar-chapter">
            <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="generated" permission="app.admin.plan.part.generated">
                AI生成分段(全量)
            </button>

            <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="generated_image" permission="app.admin.plan.part.generated">
                AI批量生图(只生图)
            </button>

            <!--<button class="pear-btn pear-btn-primary pear-btn-md" lay-event="role" permission="app.admin.plan.role.select">-->
                <!--<i class="layui-icon layui-icon-add-1"></i>角色管理-->
            <!--</button>-->

            <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="prompttags" permission="app.admin.plan.prompttags.batchinsert">
                 描述词标签管理
            </button>
            <button class="pear-btn pear-btn-danger pear-btn-md" lay-event="batchRemove" permission="app.admin.plan.part.delete">
                <i class="layui-icon layui-icon-delete"></i>删除
            </button>

            <button class="pear-btn pear-btn-success pear-btn-md" lay-event="generated_part" permission="app.admin.plan.part.generated">
                AI生成分段(只分段)
            </button>
            <button class="pear-btn pear-btn-success pear-btn-md" lay-event="download" permission="app.admin.plan.part.download">
                导出EXCEL
            </button>
            <button class="pear-btn pear-btn-success pear-btn-md" lay-event="batchupload" permission="app.admin.plan.part.batchupload">
                导入EXCEL
            </button>
            <!--<button class="pear-btn pear-btn-success pear-btn-md" lay-event="uploadimage" permission="app.admin.plan.part.uploadimage">-->
                <!--上传参考图-->
            <!--</button>-->
            <button class="pear-btn pear-btn-success pear-btn-md" lay-event="generatedimage" permission="app.admin.plan.part.generatedimage">
                图生图
            </button>


        </script>

        <!-- 表格行工具栏 -->
        <script type="text/html" id="table-bar-chapter">
            <button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.plan.part.update">编辑</button>
            <!--<button class="pear-btn pear-btn-xs tool-btn" lay-event="edit" permission="app.admin.plan.part.edit">编辑描述</button>-->
            <!--<button class="pear-btn pear-btn-xs tool-btn" lay-event="prompt" permission="app.admin.plan.part.generatedprompt">重改描述词</button>-->
            <!--<button class="pear-btn pear-btn-xs tool-btn" lay-event="image" permission="app.admin.plan.part.generatedimage">重改AI图</button>-->
            <button class="pear-btn pear-btn-xs tool-btn" lay-event="subtitle" permission="app.admin.plan.part.subtitle">字幕</button>
            <button class="pear-btn pear-btn-xs tool-btn" lay-event="remove" permission="app.admin.plan.part.delete">删除</button>
        </script>



        <script src="/app/admin/component/layui/layui.js?v=2.8.12"></script>
        <script src="/app/admin/component/pear/pear.js"></script>
        <script src="/app/admin/admin/js/permission.js"></script>
        <script src="/app/admin/admin/js/common.js"></script>
        <script src="/app/admin/admin/js/functions.js"></script>
        <script src="/app/admin/admin/js/md5.js"></script>

        <script>
            let counts = 0;
            let changeIds = [];
            // 相关常量
            const PRIMARY_KEY = "id";
            const PLANID = layui.url().search['planid'];
            const SELECT_API = "/app/admin/plan/part/select" + location.search;
            const UPDATE_API = "/app/admin/plan/part/update";
            const DELETE_API = "/app/admin/plan/part/delete";
            const INSERT_URL = "/app/admin/plan/part/insert" + location.search;
            const UPDATE_URL = "/app/admin/plan/part/update";
            const VIEW_URL = "/app/admin/plan/part/view";
            const GENERATED_API = "/app/admin/plan/part/generated";
            const PROGRESS_URL = "/app/admin/plan/part/getprogress";
            const SUBTITLE_URL = "/app/admin/plan/part/subtitle";
            const PROMPT_API = "/app/admin/plan/part/generatedprompt";
            const IMAGE_URL = "/app/admin/plan/part/generatedimage";
            const PLAN_SELECT_API = "/app/admin/plan/index/select";
            const NOVEL_INDEX_URL = "/app/admin/novel/index/index";
            const ROLE_URL = "/app/admin/plan/role/index";
            const TAGS_URL = "/app/admin/plan/prompttags/batchinsert";
            const DOWNLOAD_API = "/app/admin/plan/part/download";
            const BATCHUPLOAD_URL = "/app/admin/plan/part/batchupload";
            const UPLOAD_URL = "/app/admin/plan/part/uploadimage";
            const GENERATE_IMAGE_URL = "/app/admin/plan/part/generatedimagetoimage";


            let where = {"planid":PLANID};
            let isHide =false;

            // 获取数据库记录
            layui.use(["form", "util", "popup"], function () {
                $ = layui.$;
                $.ajax({
                    url: PLAN_SELECT_API,
                    data:{"id":PLANID},
                    dataType: "json",
                    async:true,
                    headers: get_header({"id":PLANID}),
                    success: function (res) {
                        layui.$('.novel_sn').text(res.data[0]['novel_sn']);
                        layui.$('.novel_title').text(res.data[0]['title']);
                        layui.$('.plan_name').text(res.data[0]['name']);
                        layui.$('.plan_id').text(res.data[0]['id']);

                        // ajax返回失败
                        if (res.code) {
                            layui.popup.failure(res.msg);
                        }
                    }

                });
            });

            // 表格渲染
            layui.use(["table", "form", "common", "popup", "util", 'loading', 'code', 'element'], function() {
                let table = layui.table;
                let form = layui.form;
                $ = layui.$;
                let common = layui.common;
                let util = layui.util;
                let loading = layui.loading;
                let element = layui.element;

				// 表头参数
				let cols = [
					{
						type: "checkbox", align: "center"
					},{
						title: "ID",align: "center", field: "id",width:100,sort:true,
					},{
						title: "分段内容",align: "center", field: "content",minWidth:120,
					}
					// ,{
					// 	title: "匹配角色",align: "center", field: "rolename",minWidth:150,
					// }
					,{
						title: "分段序号",align: "center", field: "number",width:100,sort:true,
					}
					// ,{
                    //     title: "中文描述词",align: "center", field: "analyze_content",minWidth:120,
                    // }
                    ,{
						title: "英文描述词",align: "center", field: "prompt",minWidth:120,
					},{
						title: "MJ关键词",align: "center", field: "mj_keyword",width:120,
					},{
						title: "参考图",align: "center", field: "refer_image",width:100,templet: function (d) {
                            if(d['refer_image']){
                                return '<img src="'+encodeURI(d['refer_image'])+'" style="max-width:32px;max-height:32px;" alt="'+d['id']+'--0--'+d['number']+'--'+d['content']+'" />';
                            }else{
                                return '';
                            }
                        }
					},{
						title: "图片1",align: "center", field: "ai_images1",width:100,templet: function (d) {
                            if(d['ai_images1']){
                                return '<img src="'+encodeURI(d['ai_images1'])+'" style="max-width:32px;max-height:32px;" alt="'+d['id']+'--1--'+d['number']+'--'+d['content']+'" />';
                            }else{
                                return '';
                            }
                        }
					},{
						title: "图片2",align: "center", field: "ai_images2",width:100,templet: function (d) {
                            if(d['ai_images2']){
                                return '<img src="'+encodeURI(d['ai_images2'])+'" style="max-width:32px;max-height:32px;" alt="'+d['id']+'--2--'+d['number']+'--'+d['content']+'" />';
                            }else{
                                return '';
                            }
                        }
					}
					// ,{
					// 	title: "图片3",align: "center", field: "ai_images3",width:100,templet: function (d) {
                    //         if(d['ai_images3']){
                    //             return '<img src="'+encodeURI(d['ai_images3'])+'" style="max-width:32px;max-height:32px;" alt="" />';
                    //         }else{
                    //             return '';
                    //         }
                    //     }
					// },{
					// 	title: "图片4",align: "center", field: "ai_images4",width:100,templet: function (d) {
                    //         if(d['ai_images4']){
                    //             return '<img src="'+encodeURI(d['ai_images4'])+'" style="max-width:32px;max-height:32px;" alt="" />';
                    //         }else{
                    //             return '';
                    //         }
                    //     }
					// }
					,{
                        title: "播放声音",align: "center", field: "timbre_voice_url",width:200,templet: function (d) {
                            if(d['timbre_voice_url']){
                                return '<audio controls>'+
                                    '<source src="'+d['timbre_voice_url']+'" type="audio/mpeg">'+
                                    '<object data="'+d['timbre_voice_url']+'">'+
                                    '</object> '+
                                    '</audio>';
                            }else{
                                return ' ';
                            }
                        }
                    },{
                        title: '更新时间',align: "center",field: 'updated_at',width:160,sort:true
                    },{
						title: "操作", toolbar: "#table-bar-chapter", align: "center", fixed: "right", width: 160,
					}
				];
				
				// 渲染表格
				table.render({
				    elem: "#data-table-chapter",
				    url: SELECT_API,
				    page: true,
                    headers: get_header(where),
				    cols: [cols],
				    skin: "line",
				    size: "lg",
				    toolbar: "#table-toolbar-chapter",
				    autoSort: false,
				    defaultToolbar: [{
				        title: "刷新",
				        layEvent: "refresh",
				        icon: "layui-icon-refresh",
				    }, "filter", "print", "exports"],
				    done: function (res, curr, count) {
                        counts = count;

				        layer.photos({photos: 'div[lay-id="data-table-chapter"]', anim: 5, tab: function(pic, layero){
                                //console.log(pic) //当前图片的一些信息
                                let id = pic.alt.split('--')[0];
                                let n = pic.alt.split('--')[1];
                                let x = pic.alt.split('--')[2];

                                if(changeIds.indexOf(id.toString())>-1){
                                    layui.$.ajax({
                                        url: '/app/admin/plan/part/select'+ "?" + PRIMARY_KEY + "=" + id,
                                        dataType: "json",
                                        async: true,
                                        headers: get_header({"id": id}),
                                        success: function (res) {
                                            let image = res.data[0]['ai_images'+n];
                                            let alt = id+'--'+n+'--'+x+'--'+res.data[0]['content'];
                                            layui.$('.layui-layer-phimg>img').attr("src",image);
                                            layui.$('.layui-layer-imgtit>h3').text(alt);
                                        }
                                    })
                                }

                                //console.log(id);
                                layui.$('.layui-layer-imgbar>.layui-layer-imgtit').append('<a href="javascript:;" onclick="edit2('+id+','+n+','+x+')" >编辑</a>')
                        }});
				    }
				});

                // 编辑或删除行事件
                table.on("tool(data-table-chapter)", function(obj) {
                    if (obj.event === "remove") {
                        remove(obj);
                    } else if (obj.event === "edit") {
                        edit(obj);
                    } else if (obj.event === "subtitle") {
                        subtitle(obj);
                    } else if (obj.event === "prompt") {
                        prompt(obj);
                    } else if (obj.event === "image") {
                        image(obj);
                    }
                });

                // 表格顶部工具栏事件
                table.on("toolbar(data-table-chapter)", function(obj) {
                    if (obj.event === "add") {
                        add();
                    } else if (obj.event === "refresh") {
                        refreshTable();
                    } else if (obj.event === "batchRemove") {
                        batchRemove(obj);
                    } else if (obj.event === "generated") {
                        generated();
                    } else if (obj.event === "generated_part") {
                        generated_part();
                    } else if (obj.event === "generated_image") {
                        generated_image();
                    } else if (obj.event === "role") {
                        role();
                    } else if (obj.event === "prompttags") {
                        prompttags();
                    } else if (obj.event === "download") {
                        download();
                    } else if (obj.event === "batchupload") {
                        batchUpload(obj);
                    } else if (obj.event === "uploadimage") {
                        uploadimage(obj);
                    } else if (obj.event === "generatedimage") {
                        generatedimage(obj);
                    }
                });

                // 表格排序事件
                table.on("sort(data-table-chapter)", function(obj){
                    where.field=obj.field;
                    where.order=obj.type;
                    table.reload("data-table", {
                        initSort: obj,
                        scrollPos: "fixed",
                        where: where,
                        headers: get_header(where)
                    });
                });

                // 表格新增数据
                let add = function() {
                    layer.open({
                        type: 2,
                        title: "新增",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"600px", common.isModile()?"100%":"300px"],
                        content: INSERT_URL
                    });
                }

                // 表格编辑数据
                let edit = function(obj) {
                    let value = obj.data[PRIMARY_KEY];
                    layer.open({
                        type: 2,
                        title: "修改",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"100%", common.isModile()?"100%":"100%"],
                        content: UPDATE_URL + "?" + PRIMARY_KEY + "=" + value
                    });
                }

                // 重改描述词
                let prompt = function(obj) {
                    let data = {};
                    data[PRIMARY_KEY] = obj.data[PRIMARY_KEY];
                    layer.confirm("确定重改描述词吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let loading = layer.load();
                        $.ajax({
                            url: PROMPT_API,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                layer.close(loading);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }
                                return layui.popup.success("操作成功", refreshTable);
                            }
                        })
                    });
                }

                // 重改AI图
                let image = function(obj) {
                    let value = obj.data[PRIMARY_KEY];
                    layer.confirm("确定重改AI图吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        layer.open({
                            type: 2,
                            title: "重改AI图",
                            shade: 0.1,
                            maxmin: true,
                            area: [common.isModile()?"100%":"900px", common.isModile()?"100%":"95%"],
                            content: IMAGE_URL + "?" + PRIMARY_KEY + "=" + value,
                            end: function(){
                                refreshTable();
                            }
                        });
                    })

                }

                // 字幕
                let subtitle = function(obj) {
                    let value = obj.data[PRIMARY_KEY];
                    layer.open({
                        type: 2,
                        title: "字幕管理",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"600px"],
                        content: SUBTITLE_URL + "?" + PRIMARY_KEY + "=" + value
                    });
                }

                // 删除一行
                let remove = function(obj) {
                    return doRemove(obj.data[PRIMARY_KEY]);
                }

                // 删除多行
                let batchRemove = function(obj) {
                    let checkIds = common.checkField(obj, PRIMARY_KEY);
                    if (checkIds === "") {
                        layui.popup.warning("未选中数据");
                        return false;
                    }
                    doRemove(checkIds.split(","));
                }

                // 执行删除
                let doRemove = function (ids) {
                    let data = {};
                    data[PRIMARY_KEY] = ids;
                    layer.confirm("确定删除?", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let loading = layer.load();
                        $.ajax({
                            url: DELETE_API,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                layer.close(loading);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }
                                return layui.popup.success("操作成功", refreshTable);
                            }
                        })
                    });
                }

                // AI生成分段
                let generated = function () {
                    layer.confirm("每次生成，会覆盖当前生成的分段哦，确定生成吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let data = {};
                        data['planid'] = PLANID;
                        data['type'] = 'all';
                        let loadIndex = loading.Load(5, "生成中...");
                        $.ajax({
                            url: GENERATED_API,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                loading.loadRemove(1);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }else{
                                    layer.open({
                                        type: 2,
                                        title: "AI生成分段 - 进度条",
                                        shade: 0.1,
                                        maxmin: true,
                                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"100px"],
                                        content: PROGRESS_URL + "?requestid=" + res.data.requestid,
                                        end: function(){
                                            //refreshTable();
                                        }
                                    });
                                }
                            }
                        })
                    });
                }

                // AI批量生图
                let generated_part = function () {
                    layer.confirm("确定生成吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let data = {};
                        data['planid'] = PLANID;
                        data['type'] = 'part';
                        let loading = layer.load();
                        $.ajax({
                            url: GENERATED_API,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                layer.close(loading);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }else{
                                    layer.open({
                                        type: 2,
                                        title: "AI生成分段 - 进度条",
                                        shade: 0.1,
                                        maxmin: true,
                                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"100px"],
                                        content: PROGRESS_URL + "?requestid=" + res.data.requestid,
                                        end: function(){
                                            //refreshTable();
                                        }
                                    });
                                }
                            }
                        })
                    });
                }

                // AI批量生图
                let generated_image = function () {
                    if(counts==0){
                        layer.msg('前提是先分好段,才能生图',{icon:2,time:2000});
                        return false;
                    }
                    layer.confirm("前提是先分好段,才能只生图。每次生成会覆盖原来的ai图，确定生成吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let data = {};
                        data['planid'] = PLANID;
                        data['type'] = 'image';
                        let loadIndex = loading.Load(5, "生成中...");
                        $.ajax({
                            url: GENERATED_API,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                loading.loadRemove(1);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }else{
                                    layer.open({
                                        type: 2,
                                        title: "AI批量生图 - 进度条",
                                        shade: 0.1,
                                        maxmin: true,
                                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"100px"],
                                        content: PROGRESS_URL + "?requestid=" + res.data.requestid,
                                        end: function(){
                                            //refreshTable();
                                        }
                                    });
                                }
                            }
                        })
                    });
                }

                // AI生成分段
                let role = function () {
                    layer.open({
                        type: 2,
                        title: "角色管理",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"100%", common.isModile()?"100%":"100%"],
                        content: ROLE_URL + "?planid=" + PLANID
                    });
                }

                // 描述词标签
                let prompttags = function () {
                    layer.open({
                        type: 2,
                        title: "描述词标签管理",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"500px"],
                        content: TAGS_URL + "?planid=" + PLANID
                    });
                }

                //导出excel
                let download = function () {
                    layer.confirm("确定导出吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        //layer.close(index);
                        //location.href = DOWNLOAD_API+'?planid='+PLANID+'&page=1&limit=200';
                        layer.close(index);
                        let data = {};
                        data['planid'] = PLANID;
                        data['page'] = 1;
                        data['limit'] = 200;
                        let loading = layer.load();
                        $.ajax({
                            url: DOWNLOAD_API,
                            data: data,
                            dataType: "json",
                            type: "get",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                layer.close(loading);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }else{
                                    location.href = res.data.filename;
                                }
                            }
                        })
                    });
                }

                // 批量上传excel
                let batchUpload = function() {
                    if(counts==0){
                        layer.msg('前提是先分好段,才能批量导入',{icon:2,time:2000});
                        return false;
                    }
                    layer.open({
                        type: 2,
                        title: "批量导入",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"550px", common.isModile()?"100%":"350px"],
                        content: BATCHUPLOAD_URL + location.search
                    });
                }

                // 批量上传参考图
                let uploadimage = function() {
                    if(counts==0){
                        layer.msg('前提是先分好段,才能上传参考图',{icon:2,time:2000});
                        return false;
                    }
                    layer.open({
                        type: 2,
                        title: "批量上传参考图",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"95%", common.isModile()?"100%":"95%"],
                        content: UPLOAD_URL + location.search
                    });
                }

                // 图生图
                let generatedimage = function() {
                    layer.confirm("前提是上传了参考图。才能图生图，确定生成吗？", {
                        icon: 3,
                        title: "提示"
                    }, function(index) {
                        layer.close(index);
                        let data = {};
                        data['planid'] = PLANID;
                        data['type'] = 'all';
                        let loadIndex = loading.Load(5, "生成中...");
                        $.ajax({
                            url: GENERATE_IMAGE_URL,
                            data: data,
                            dataType: "json",
                            type: "post",
                            async:true,
                            headers: get_header(data),
                            success: function(res) {
                                loading.loadRemove(1);
                                if (res.code) {
                                    return layui.popup.failure(res.msg);
                                }else{
                                    layer.open({
                                        type: 2,
                                        title: "图生图 - 进度条",
                                        shade: 0.1,
                                        maxmin: true,
                                        area: [common.isModile()?"100%":"800px", common.isModile()?"100%":"100px"],
                                        content: PROGRESS_URL + "?requestid=" + res.data.requestid,
                                        end: function(){
                                            //refreshTable();
                                        }
                                    });
                                }
                            }
                        })
                    });
                }

                // 刷新表格数据
                window.refreshTable = function(param) {
                    table.reloadData("data-table-chapter", {
                        scrollPos: "fixed"
                    });
                }

                window.view_novel = function ($this) {
                    let novel_sn = layui.$('.novel_sn').text();
                    layer.open({
                        type: 2,
                        title: "预览",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"95%", common.isModile()?"100%":"95%"],
                        content: NOVEL_INDEX_URL + "?" + "novel_sn=" + novel_sn
                    });
                }

                // 表格编辑数据
                window.edit2 = function(id,n,x) {
                    let value = id;
                    layer.open({
                        type: 2,
                        title: "修改",
                        shade: 0.1,
                        maxmin: true,
                        area: [common.isModile()?"100%":"100%", common.isModile()?"100%":"100%"],
                        content: UPDATE_URL + "?" + PRIMARY_KEY + "=" + value,
                        end:function () {
                            if(changeIds.indexOf(value)==-1){
                                changeIds.push(value.toString())
                            }
                            layui.$.ajax({
                                url: '/app/admin/plan/part/select'+ "?" + PRIMARY_KEY + "=" + value,
                                dataType: "json",
                                async: true,
                                headers: get_header({"id": value}),
                                success: function (res) {
                                    let image = res.data[0]['ai_images'+n];
                                    let alt = value+'--'+n+'--'+x+'--'+res.data[0]['content'];
                                    layui.$('.layui-layer-phimg>img').attr("src",image);
                                    layui.$('.layui-layer-imgtit>h3').text(alt);
                                }
                            })
                        }
                    });
                }
            })

        </script>
    </body>
</html>
